#[allow(clippy::ptr_arg)]
fn three_consecutive_vowels1(word: &String) -> bool {
    let mut vowel_count = 0;
    for c in word.chars() {
        match c {
            'a' | 'e' | 'i' | 'o' | 'u' => {
                vowel_count += 1;
                if vowel_count >= 3 {
                    return true;
                }
            }
            _ => vowel_count = 0,
        }
    }

    false
}

fn three_consecutive_vowels2(word: &str) -> bool {
    let mut vowel_count = 0;
    for c in word.chars() {
        match c {
            'a' | 'e' | 'i' | 'o' | 'u' => {
                vowel_count += 1;
                if vowel_count >= 3 {
                    return true;
                }
            }
            _ => vowel_count = 0,
        }
    }

    false
}

fn main() {
    {
        let ferris = "Ferris".to_string();
        let curious = "Curious".to_string();
        println!("{}: {}", ferris, three_consecutive_vowels1(&ferris));
        println!("{}: {}", curious, three_consecutive_vowels1(&curious));

        // This works fine, but the following two lines would fail:
        // println!("Ferris: {}", three_vowels("Ferris"));
        // println!("Curious: {}", three_vowels("Curious"));
    }

    println!();

    {
        let ferris = "Ferris".to_string();
        let curious = "Curious".to_string();
        println!("{}: {}", ferris, three_consecutive_vowels2(&ferris));
        println!("{}: {}", curious, three_consecutive_vowels2(&curious));
        println!("Ferris: {}", three_consecutive_vowels2("Ferris"));
        println!("Curious: {}", three_consecutive_vowels2("Curious"));

        let sentence_string =
            "Once upon a time, there was a friendly curious crab named Ferris".to_string();
        for word in sentence_string.split(' ') {
            if three_consecutive_vowels2(word) {
                println!("{word} has three consecutive vowels!");
            }
        }
    }
}
